package br.com.caelum.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class TestaListagem {

	public static void main(final String[] args) throws SQLException {

		final ConnectionPool dataBase = new ConnectionPool();

		for (int i = 0; i < 100; i++) {
			final Connection connection = dataBase.getConnection();

			final Statement statement = connection.createStatement();
			final Boolean result = statement.execute("select * from Produto");
			System.out.println(result);

			final ResultSet resultSet = statement.getResultSet();

			while (resultSet.next()) {
				final int id = resultSet.getInt("id");
				final String nome = resultSet.getString("nome");
				final String desc = resultSet.getString("descricao");
				System.out.println("id: " + id);
				System.out.println("nome: " + nome);
				System.out.println("descricao: " + desc);
			}

			statement.close();
			resultSet.close();
			connection.close();

		}
	}

}
